package com.nidu.demo.file.dto;

import com.nidu.demo.base.BaseCmd;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 文件上传命令
 *
 * @author auto
 */
@Data
@Schema(description = "文件上传命令")
@EqualsAndHashCode(callSuper = true)
public class FileUploadCmd extends BaseCmd {

    @NotNull(message = "文件内容不能为空")
    @Schema(description = "文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
    private byte[] content;

    @Size(max = 256, message = "文件名长度不能超过256个字符")
    @Schema(description = "文件名", example = "avatar.jpg")
    private String name;

    @Size(max = 512, message = "目录路径长度不能超过512个字符")
    @Schema(description = "目录", example = "avatar")
    private String directory;

    @Size(max = 128, message = "文件类型长度不能超过128个字符")
    @Schema(description = "文件的 MIME 类型", example = "image/jpeg")
    private String type;

}
